Ext.define('Admin.view.pivot.Clipboard', {
			extend : 'Ext.pivot.Grid',

			requires : ['Ext.grid.selection.SpreadsheetModel', 'Ext.grid.plugin.Clipboard',
					'Ext.pivot.update.Overwrite', 'Ext.pivot.plugin.CellEditing', 'Ext.pivot.plugin.Exporter'],

			selModel : {
				type : 'spreadsheet'
			},

			plugins : ['clipboard', 'selectionreplicator', 'pivotcellediting', 'pivotexporter'],

			getModifiedRecs : function() {
				var pivot = this, store = pivot.getStore();
				pivot.updateParseValue();
				return store.getModifiedRecords();
			},

			commitChanges : function() {
				var pivot = this, store = pivot.getStore();
				store.commitChanges();
				pivot.getView().getStore().commitChanges();
			},

			privates : {
				getArrayStoreModified : function(store) {
					var result = new Array();
					var items = store.getDataSource().items;
					for (var i in items) {
						if (items[i].dirty) {
							result.push(items[i]);
						}
					}
					return result;
				},

				updateParseValue : function() {
					var me = this, matrix = me.getMatrix();

					var store = me.getView().getStore();
					var arrayRecs = me.getArrayStoreModified(store);

					if (Ext.isEmpty(matrix) || Ext.isEmpty(arrayRecs)) {
						return new Array();
					}

					var columns = me.getColumns(), columnsMap = new Map();
					for (var i in columns) {
						columnsMap.set(columns[i].dataIndex, columns[i]);
					}
					for (var i in arrayRecs) {
						var arrayRec = arrayRecs[i], arrayModified = arrayRec.modified;
						for (var c in arrayModified) {
							var column = columnsMap.get(c);
							if (column) {
								var pviotItem = matrix.results.get(me.getLeftAxisItem(arrayRec).key, me
												.getTopAxisItem(column).key);
								var records = pviotItem.records, len, i;
								if (records) {
									len = records.length;
									for (i = 0; i < len; i++) {
										records[i].set(column.dimension.dataIndex, arrayRec.data[c]);
									}
								}
							}
						}
					}
				}
			},
			listeners : {
				pivotbeforeupdate : function() {
					this.updateParseValue();
				}
			}
		});